# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python-arsenic
_pkgname=arsenic
pkgver=21.8
pkgrel=7
pkgdesc='Async WebDriver implementation for asyncio and asyncio-compatible frameworks.'
arch=('any')
url='https://github.com/HDE/arsenic/releases'
license=('Apache')
depends=('python' 'python-pip' 'python-build' 'python-attrs' 'python-structlog'
         'python-aiohttp' 'geckodriver')
makedepends=('python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('55fd0e6f9acf1f578d990146b81f7f91d8c58aa68601840346c80cf7c535d5412a983c1cf0ee355383f80f6b667ef7a63b22dae8192b51e85541258a143ab366')

prepare() {
  cd "$_pkgname-$pkgver"

  sed -i 's|structlog = "^20.1.0"|structlog = ">=22.1.0"|g' pyproject.toml
}

build() {
  cd "$_pkgname-$pkgver"

  python -m build --wheel --outdir="$startdir/dist"
}

package() {
  cd "$_pkgname-$pkgver"

  pip install \
    --verbose \
    --disable-pip-version-check \
    --no-warn-script-location \
    --no-compile \
    --ignore-installed \
    --no-deps \
    --root="$pkgdir" \
    --prefix=/usr \
    --no-index \
    --find-links="file://$startdir/dist" \
    $_pkgname
}

